package com.wty.cmims.controller;

import com.wty.cmims.pojo.InstitutionType;
import com.wty.cmims.pojo.ResponseResult;
import com.wty.cmims.service.InstitutionTypeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/institutionType")
@Tag(name = "医疗机构——药品信息", description = "社区医疗信息后台管理系统api接口")
public class InstitutionTypeController {
    @Autowired
    private InstitutionTypeService institutionTypeService;
    // 医疗机构类型获取（不分页）
    @PostMapping("/findInstitutionType")
    @Operation(summary = "医疗机构类型获取（不分页）", description = "医疗机构类型获取（不分页）")
    @Parameter(name = "paramsMap",description = "参数列表")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<Map<String, Object>> institutionTypeFind(@RequestBody Map<String,Object> paramsMap){
        return institutionTypeService.institutionTypeFind(paramsMap);
    }

    // 医疗机构类型获取（分页）
    @PostMapping("/findInstitutionTypes")
    @Operation(summary = "医疗机构类型获取（分页）", description = "医疗机构类型获取（分页）")
    @Parameter(name = "paramsMap",description = "参数列表")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<Map<String, Object>> institutionTypesFind(@RequestBody Map<String,Object> paramsMap){
        return institutionTypeService.institutionTypesFind(paramsMap);
    }

    // 修改医疗机构类型
    @PutMapping("/updateInstitutionType")
    @Operation(summary = "修改医疗机构类型", description = "修改医疗机构类型")
    @Parameter(name = "InstitutionType",description = "医疗机构类型")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<Void> institutionTypeUpdate(@RequestBody InstitutionType institutionType){
        return institutionTypeService.institutionTypeUpdate(institutionType);
    }

    // 添加医疗机构类型
    @PostMapping("/addInstitutionType")
    @Operation(summary = "添加医疗机构类型", description = "添加医疗机构类型")
    @Parameter(name = "InstitutionType",description = "医疗机构类型")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<Void> addInstitutionType(@RequestBody InstitutionType institutionType){
        return institutionTypeService.institutionTypeAdd(institutionType);
    }
}